Skip to content

Commit ff2b573

Browse files
MariaDchivo-stoilovMaria Chervenkova
authored
merge develop into master (#224)
* Use common signing (#208) o closes telerik/MATTeam#710 * Support for .NET Standard 2.1 (#209) o converted JustMock project .NET Core App 2.0 target to .NET Standard 2.1 o removed JustMock project .NET Framework 4.5.0 target o re-target all JustMock dependent projects to .NET Framework 4.7.2 * Raise Async Event causes Method Signature Error (#211) * Raise Async Event causes Method Signature Error o closes #745 * Raise Async Event causes Method Signature Error o applied review comments * Support for .NET 9 preview 6 (#212) o fixed ref returns interception * Fix the vulnerable transitive dependency to System.Security.Permissions 5.0.0 (#213) o closes telerik/MATTeam#753 * fix: Implement methods for automocking #759 - Implement Arrange and ReturnsAsync methods for Task; - Implement Arrange method for ValueTask; * fix: Add tests for automocking - Add test for Arrange an ReturnsAsync; * chore: Change copyright information * chore: Replace tabs with spaces (#216) * chore: Replace tabs with spaces - Closes #782 * fix: Broken symbols --------- Co-authored-by: Maria Chervenkova <[email protected]> * fix: Set NEWOBJ_INTERCEPTION_ON_OVERWRITE var to be disabled by default (#217) Co-authored-by: Maria Chervenkova <[email protected]> * Fix .NET versions in the readme files (#218) * fix: Create tests for Mock.Reset (#220) * fix: Create tests for Mock.Reset * fix: SonarQube scanner findings - Refactor test code to remove copy-paste --------- Co-authored-by: Maria Chervenkova <[email protected]> * Update license files (#221) * Update license files (#222) * Update license files (#223) o replace the link --------- Co-authored-by: Ivo Stoilov <[email protected]> Co-authored-by: Maria Chervenkova <[email protected]>
1 parent d6df950 commit ff2b573

File tree

4 files changed

+138
-1
lines changed

4 files changed

+138
-1
lines changed

LICENSE

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Packaged distributions of JustMock Lite obtained from NuGet are made
2+
available pursuant to the Progress® Telerik® JustMock EULA at
3+
https://www.telerik.com/purchase/license-agreements, unless you have
4+
entered into a separate software license agreement with the licensor
5+
that covers JustMock Lite.
6+
7+
Source code obtained from the Progress Telerik JustMock Lite GitHub
8+
repository is made available under Apache-2.0, a copy of which is
9+
included below.
110

211
Apache License
312
Version 2.0, January 2004
@@ -187,7 +196,8 @@
187196
same "printed page" as the copyright notice for easier
188197
identification within third-party archives.
189198

190-
Copyright 2010-2018 Telerik EAD
199+
Copyright 2010-2024 Progress Software Corporation and/or its subsidiaries
200+
or affiliates. All Rights Reserved.
191201

192202
Licensed under the Apache License, Version 2.0 (the "License");
193203
you may not use this file except in compliance with the License.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ JustMock
4545
- **Mock Microsoft EntityFramework** - Allows you to easily create in-memory mocks of the DbSet and DbContext types.
4646
- And many more
4747

48+
### Licensing
49+
50+
Packaged distributions of Progress Telerik JustMock Lite obtained from NuGet are made available pursuant to the Progress Telerik JustMock EULA at https://www.telerik.com/purchase/license-agreements, unless you have entered into a separate MSA with the licensor.
51+
52+
Source code obtained from the Progress Telerik JustMock Lite GitHub repository is made available under Apache-2.0.
53+
4854
### Examples
4955

5056
```csharp
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
#region JustMock Test Attributes
6+
#if NUNIT
7+
using NUnit.Framework;
8+
using TestCategory = NUnit.Framework.CategoryAttribute;
9+
using TestClass = NUnit.Framework.TestFixtureAttribute;
10+
using TestMethod = NUnit.Framework.TestAttribute;
11+
using TestInitialize = NUnit.Framework.SetUpAttribute;
12+
using TestCleanup = NUnit.Framework.TearDownAttribute;
13+
using AssertionException = NUnit.Framework.AssertionException;
14+
#if NUNIT3
15+
using ClassInitialize = NUnit.Framework.OneTimeSetUpAttribute;
16+
using ClassCleanup = NUnit.Framework.OneTimeTearDownAttribute;
17+
#endif
18+
#elif XUNIT
19+
using Xunit;
20+
using Telerik.JustMock.XUnit.Test.Attributes;
21+
using TestCategory = Telerik.JustMock.XUnit.Test.Attributes.XUnitCategoryAttribute;
22+
using TestClass = Telerik.JustMock.XUnit.Test.Attributes.EmptyTestClassAttribute;
23+
using TestMethod = Xunit.FactAttribute;
24+
using TestInitialize = Telerik.JustMock.XUnit.Test.Attributes.EmptyTestInitializeAttribute;
25+
using TestCleanup = Telerik.JustMock.XUnit.Test.Attributes.EmptyTestCleanupAttribute;
26+
using AssertionException = Telerik.JustMock.XUnit.AssertFailedException;
27+
#elif VSTEST_PORTABLE
28+
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
29+
using AssertionException = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AssertFailedException;
30+
#else
31+
using Microsoft.VisualStudio.TestTools.UnitTesting;
32+
using AssertionException = Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException;
33+
#endif
34+
#endregion
35+
36+
namespace Telerik.JustMock.Tests
37+
{
38+
[TestClass]
39+
public class MockResetFixture
40+
{
41+
#if NUNIT3
42+
private static Foo staticFoo;
43+
[ClassInitialize]
44+
public static void ClassInitialize()
45+
{
46+
staticFoo = Mock.Create<Foo>();
47+
Mock.Arrange(() => staticFoo.FooNotImplemented());
48+
}
49+
50+
[ClassCleanup]
51+
public static void ClassCleanup()
52+
{
53+
Mock.Reset();
54+
Assert.Throws<NotImplementedException>(() => staticFoo.FooNotImplemented());
55+
}
56+
#elif !NUNIT && !XUNIT
57+
private static Foo staticFoo;
58+
[ClassInitialize]
59+
public static void ClassInitialize(TestContext ctx){
60+
staticFoo = Mock.Create<Foo>();
61+
Mock.Arrange(() => staticFoo.FooNotImplemented());
62+
}
63+
64+
[ClassCleanup]
65+
public static void ClassCleanup()
66+
{
67+
Mock.Reset();
68+
Assert.Throws<NotImplementedException>(() => staticFoo.FooNotImplemented());
69+
}
70+
71+
#endif
72+
private Foo myFoo;
73+
[TestInitialize]
74+
public void TestInit()
75+
{
76+
myFoo = Mock.Create<Foo>();
77+
Mock.Arrange(() => myFoo.FooNotImplemented());
78+
}
79+
80+
[TestCleanup]
81+
public void TestCleanup()
82+
{
83+
Mock.Reset();
84+
Assert.Throws<NotImplementedException>(() => myFoo.FooNotImplemented());
85+
}
86+
87+
[TestMethod]
88+
public void ThrowNotImplementedAfterMockReset()
89+
{
90+
// Arrange
91+
var myFoo = Mock.Create<Foo>();
92+
93+
// Act
94+
Mock.Reset();
95+
96+
// Assert
97+
Assert.Throws<NotImplementedException>(() => myFoo.FooNotImplemented());
98+
}
99+
100+
[TestMethod]
101+
public void DoNotThrowErrorWithMockReset()
102+
{
103+
// Act
104+
Mock.Reset();
105+
106+
// Assert
107+
myFoo.FooNotImplemented();
108+
109+
}
110+
111+
class Foo
112+
{
113+
public void FooNotImplemented()
114+
{
115+
throw new NotImplementedException();
116+
}
117+
}
118+
119+
}
120+
}

Telerik.JustMock.Tests/Telerik.JustMock.Tests.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<Compile Include="$(MSBuildThisFileDirectory)MatchersFixture.cs" />
4848
<Compile Include="$(MSBuildThisFileDirectory)MiscFixture.cs" />
4949
<Compile Include="$(MSBuildThisFileDirectory)MockFixture.cs" />
50+
<Compile Include="$(MSBuildThisFileDirectory)MockResetFixture.cs" />
5051
<Compile Include="$(MSBuildThisFileDirectory)NinjectAutoMockFixture.cs" />
5152
<Compile Include="$(MSBuildThisFileDirectory)NonPublicFixture.cs" />
5253
<Compile Include="$(MSBuildThisFileDirectory)OccurrenceFixture.cs" />

0 commit comments

Comments
 (0)