public void Should_not_fail_on_objects_with_circular_dependencies()
        {
            var value1 = new ClassWithDependency();
            var value2 = new ClassWithDependency();

            value1.Prop = value2;
            value2.Prop = value1;

            Format(value1).Should().Be(@"{""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": {""Prop"": ""<too deep>""}}}}}}}}}}");
        }
Exemplo n.º 2
0
        public void GetAliasName_GivenAbc_ReturnXyz()
        {
            // Arrange a Mock
            const string name     = "Abc";
            const string expected = "Xyz";

            var moq = new Mock <IDependency>();

            moq.Setup(di => di.GetNickName(name))
            .Returns(expected);

            var service = new ClassWithDependency(moq.Object);

            // Act
            var actual = service.GetAliasName(name);

            // Assert
            moq.Verify(di => di.GetNickName(name), Times.Once);
            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
 public ClassWithMultipleDependencies(ITestInterface testInterfaceDep, ClassWithDependency classWithDependencyDep)
 {
     TestInterfaceDep       = testInterfaceDep;
     ClassWithDependencyDep = classWithDependencyDep;
 }