コード例 #1
0
        public void ToObject_WhenCalled_ReturnsNotNull()
        {
            IKeyValueEntry sut = CreateSut();

            TestValue result = sut.ToObject <TestValue>();

            Assert.That(result, Is.Not.Null);
        }
コード例 #2
0
        public void ToObject_WhenCalled_ReturnsObjectFromValue()
        {
            int       identifier = _fixture.Create <int>();
            string    name       = _fixture.Create <string>();
            DateTime  birthday   = DateTime.Today.AddYears(_random.Next(10, 75) * -1).AddDays(_random.Next(-120, 120));
            decimal   balance    = _fixture.Create <decimal>();
            TestValue testValue  = new TestValue
            {
                Identifier = identifier,
                Name       = name,
                Birthday   = birthday,
                Balance    = balance
            };
            IKeyValueEntry sut = CreateSut(testValue);

            TestValue result = sut.ToObject <TestValue>();

            Assert.That(result.Identifier, Is.EqualTo(identifier));
            Assert.That(result.Name, Is.EqualTo(name));
            Assert.That(result.Birthday, Is.EqualTo(birthday));
            Assert.That(result.Balance, Is.EqualTo(balance));
        }
コード例 #3
0
        public void Create_WhenCalledWithKeyAndValue_ReturnsKeyValueEntryWhereValueIsSerializedByteArrayOfValue()
        {
            int       identifier = _fixture.Create <int>();
            string    name       = _fixture.Create <string>();
            DateTime  birthday   = DateTime.Today.AddYears(_random.Next(10, 75) * -1).AddDays(_random.Next(-120, 120));
            decimal   balance    = _fixture.Create <decimal>();
            TestValue testValue  = new TestValue
            {
                Identifier = identifier,
                Name       = name,
                Birthday   = birthday,
                Balance    = balance
            };
            IKeyValueEntry result = Domain.Common.KeyValueEntry.Create(_fixture.Create <string>(), testValue);

            TestValue otherTestValue = result.ToObject <TestValue>();

            Assert.That(otherTestValue, Is.Not.Null);
            Assert.That(otherTestValue.Identifier, Is.EqualTo(identifier));
            Assert.That(otherTestValue.Name, Is.EqualTo(name));
            Assert.That(otherTestValue.Birthday, Is.EqualTo(birthday));
            Assert.That(otherTestValue.Balance, Is.EqualTo(balance));
        }
コード例 #4
0
 private IKeyValueEntry CreateSut(TestValue testValue = null)
 {
     return(Domain.Common.KeyValueEntry.Create(_fixture.Create <string>(), testValue ?? _fixture.Create <TestValue>()));
 }