예제 #1
0
        public void ToString_WithSingleField_ShouldReturnValueAsString()
        {
            const int number = 1;
            var       actual = new Generated.EmployeeNumber(number).ToString();

            Assert.That(actual, Is.EqualTo("1"));
        }
예제 #2
0
        public void Constructor_WithAllValues_ShouldSetProperties()
        {
            const int number = 1;
            var       actual = new Generated.EmployeeNumber(number);

            Assert.That(actual.Value, Is.EqualTo(number));
        }
예제 #3
0
        public void Instance_WhenSerializedWithBinaryFormatter_ShouldBeSerializable()
        {
            const int number = 1;
            var       actual = new Generated.EmployeeNumber(number);

            var deserialized = SerializationTesting.SerializeDeserializeWithBinaryFormatter(actual);

            Assert.That(deserialized, Is.EqualTo(actual));
            Assert.That(actual.Value, Is.EqualTo(number));
        }
예제 #4
0
        public void EqualsGetHashCodeAndEqualityOperators()
        {
            const int number = 1;

            var a = new Generated.EmployeeNumber(number);
            var b = new Generated.EmployeeNumber(number);
            var c = new Generated.EmployeeNumber(number);

            var otherEmployeeNumber = new Generated.EmployeeNumber(number + 1);

            EqualityTesting.TestEqualsAndGetHashCode(a, b, c, otherEmployeeNumber);

            EqualityTesting.TestEqualityOperators(a, b, c, otherEmployeeNumber);
        }
예제 #5
0
 public EmployeeInfo(EmployeeNumber number, EmployeeName name, EmailAddress email)
 {
     this._number = number;
     this._name   = name;
     this._email  = email;
 }