コード例 #1
0
        public void CanCreateMissingServices()
        {
            var id       = Guid.NewGuid();
            var expected = Guid.NewGuid().ToString();

            var wrapper = new TestsWrapper <TypeWithDependency>();

            wrapper.Service <ITargetService>().GetValue(id).Returns(expected);

            var actual = wrapper.SUT.GetValue(id);

            actual.Should().Be(expected);
        }
コード例 #2
0
        public void CanCreateWithConstructorProvidedService()
        {
            var id       = Guid.NewGuid();
            var expected = Guid.NewGuid().ToString();

            var service = Substitute.For <ITargetService>();

            service.GetValue(id).Returns(expected);

            var wrapper = new TestsWrapper <TypeWithDependency>(service);

            var actual = wrapper.SUT.GetValue(id);

            actual.Should().Be(expected);
        }