public void ForAClass() { var result = new AnythingActivator(new CreateFromMock(typeof(INterface))) .New <ClassWith1ConstructorParam <INterface> >(); // Assert.That(result.Param1, x => CreateFromMock.IsAKnownMock(x)); }
public void ThereIsAMockingFrameworkInTheBaseDirectory() { var moq = new FindInAssembly("Moq").FindTypeAssignableTo("Mock`1"); // Assert.That(moq, Is.NotNull, "Didn't find a known mock framework (i.e. Moq) in Base Directory, can't test mocking."); }
public void ForAClass() { var myObject = new AClass(); var result = new AnythingActivator(DefaultRules.All.After(new ActivateInstances(myObject))) .New <AClass>(); // Assert.That(myObject == result); }
public void ForAClass() { var myObject = new AClass(); var result = new AnythingActivator( DefaultRules.All .Union(new ActivateForType <AClass>(myObject))) .New <AClass>(); // Assert.That(myObject == result); }
public void ForAFuncOf() { var myObject = new AClass(); var myString = "String!"; // var uut = new AnythingActivator(DefaultRules.All.After(new ActivateInstances(myObject, myString))); var result1 = uut.New <Func <AClass> >(); var result2 = uut.New <Func <string> >(); //Debug xconsole.WriteLine(string.Join(Environment.NewLine, uut.LastErrorList)); xconsole.WriteLine(string.Join(Environment.NewLine, uut.LastActivationTree)); // Assert.That(result1, x => x() == myObject); Assert.That(result2, x => x() == myString); }
public void AAFindsConcreteTypeEvenIfTheAssemblyIsntReferenced() { Assert.That(UnitUnderTest.Param1.GetType().Assembly.FullName.Contains("TestCases.ANotReferencedAssembly")); }
public void AndMocksAnInterface__AssumingThatAKnownMockingFrameworkAssemblyWasFindable() { UnitUnderTest.Param4.ShouldBeAssignableTo <ICloneable>(); Assert.That(CreateFromMock.IsAKnownMock(UnitUnderTest.Param4)); }
public void AndFindsConcreteTypeForINterfaceWithFakeInTestAssembly() { UnitUnderTest.Param2.ShouldBeAssignableTo <INterfaceWithFakeInTestAssembly>(); Assert.That(UnitUnderTest.Param2.GetType().Assembly, Is.EqualTo(GetType().Assembly)); }
public void AndFindsConcreteTypeForInterfaceInAssembliesInBaseDirectoryEvenIfTheAssemblyIsntReferenced() { UnitUnderTest.Param3.ShouldBeAssignableTo <INterfaceWithClassInNotReferencedAssembly>(); Assert.That(UnitUnderTest.Param3.GetType().Assembly.FullName.Contains("TestCases.ANotReferencedAssembly")); }
public void Logs_ToSpecifiedLogger() { sut.Merge(new MemoryStream(new byte[0]), new Dictionary <string, string>()); Assert.That(logger.LoggedLines, Is.NotEmpty); }
public void AAFulfillsConstructorDependencyOnINterfaceWithFakeInTestAssembly() { UnitUnderTest.Param2.ShouldBeAssignableTo <INterfaceWithFakeInTestAssembly>(); Assert.That(UnitUnderTest.Param2.GetType().Assembly, Is.EqualTo(GetType().Assembly)); }