コード例 #1
0
        public void Constructor_WithAllValues_ShouldSetProperties()
        {
            var actual = new Generated.EmployeeMetadata(Source, SourceId);

            Assert.That(actual.Source, Is.EqualTo(Source));
            Assert.That(actual.SourceId, Is.EqualTo(SourceId));
        }
コード例 #2
0
        public void Instance_WhenSerializedWithBinaryFormatter_ShouldBeSerializable()
        {
            var actual = new Generated.EmployeeMetadata(Source, SourceId);

            var deserialized = SerializationTesting.SerializeDeserializeWithBinaryFormatter(actual);

            Assert.That(deserialized, Is.EqualTo(actual));
        }
コード例 #3
0
        public void EqualsGetHashCodeAndEqualityOperators()
        {
            var a = new Generated.EmployeeMetadata(Source, SourceId);
            var b = new Generated.EmployeeMetadata(Source, SourceId);
            var c = new Generated.EmployeeMetadata(Source, SourceId);

            var otherSource       = new Generated.EmployeeMetadata(Source + "x", SourceId);
            var otherSourceId     = new Generated.EmployeeMetadata(Source, SourceId + 1);
            var otherSourceIdNull = new Generated.EmployeeMetadata(Source, null);

            EqualityTesting.TestEqualsAndGetHashCode(a, b, c, otherSource, otherSourceId, otherSourceIdNull);
            EqualityTesting.TestEqualityOperators(a, b, c, otherSource, otherSourceId, otherSourceIdNull);
        }
コード例 #4
0
        public void ToString_NullableFieldIsNull_ShouldFormatNullValueAsEmpty()
        {
            var actual = new Generated.EmployeeMetadata("Source", null).ToString();

            Assert.That(actual, Is.EqualTo("Source "));
        }
コード例 #5
0
        public void ToString_NotNull_ShouldFormatValue()
        {
            var actual = new Generated.EmployeeMetadata("Source", 1).ToString();

            Assert.That(actual, Is.EqualTo("Source 1"));
        }