コード例 #1
0
        public void Mocks_Dependencies_Correctly()
        {
            var fixture = new ValidFixture();

            var mockOne = fixture.GetMock <DependencyOne>();
            var mockTwo = fixture.GetMock <DependencyTwo>();

            Assert.AreEqual(mockOne.Object, ValidType.dependencyOne);
            Assert.AreEqual(mockTwo.Object, ValidType.dependencyTwo);
        }
コード例 #2
0
        public void Runs_Global_Fixture_Config()
        {
            var expectedObject = new Object();

            DefaultMocks.AddSetup(f =>
            {
                f.Mock <DependencyOne>()
                .Setup(x => x.GetObject(It.IsAny <Object>()))
                .Returns(expectedObject);

                f.Mock <Object>();
            });

            var fixture = new ValidFixture();

            Assert.AreEqual(expectedObject, fixture.GetMock <DependencyOne>().Object.GetObject(new Object()));
        }