Beispiel #1
0
        public void Indexed_ToString()
        {
            var i1 = new Indexed <string>("bar", 0);
            var i2 = new Indexed <string>("foo", 1);

            Assert.AreEqual("[0] bar", i1.ToString());
            Assert.AreEqual("[1] foo", i2.ToString());
        }
        public void ToString_ShouldAddAllPropertiesToOutput()
        {
            // Arrange
            TestPerson           instance    = this.fixture.Create <TestPerson>();
            Mock <IFunkyFactory> factoryMock = TestHelper.GetMockedFunkyFactory();
            Indexed sut = new Indexed(instance, true, factoryMock.Object);

            // Act
            string actual = sut.ToString();

            // Assert
            StringAssert.Contains(nameof(TestPerson.Name), actual);
            StringAssert.Contains(instance.Name, actual);
            StringAssert.Contains(nameof(TestPerson.Age), actual);
            StringAssert.Contains(instance.Age.ToString(), actual);
        }