public void SutYieldsInjectedElements() { var expected = new[] { new Mock<IReflectionElement>().Object, new Mock<IReflectionElement>().Object, new Mock<IReflectionElement>().Object }; var sut = new CompositeReflectionElement(expected); Assert.True(expected.SequenceEqual(sut)); Assert.True( expected.Cast<object>().SequenceEqual(sut.OfType<object>())); }
public void GetServicesOfTShouldReturnExpectedInstances() { // arrange var serviceProvider = new Mock<IServiceProvider>(); var expected = new[] { new object(), new object(), new object() }; serviceProvider.Setup( sp => sp.GetService( It.IsAny<Type>() ) ).Returns( expected.ToArray() ); // act var actual = serviceProvider.Object.GetServices<object>(); // assert Assert.True( expected.SequenceEqual( actual ) ); serviceProvider.Verify( sp => sp.GetService( typeof( IEnumerable<object> ) ), Times.Once() ); }
public void SortShouldOrderItemsCorrectly() { // arrange var expected = new[] { "a", "b", "c", "d", "e" }; var target = new[] { "c", "e", "b", "a", "d" }; // act target.Sort(); // assert Assert.True( target.SequenceEqual( expected ) ); }