コード例 #1
0
        public void Equals_OtherIsNull_ReturnsFalse()
        {
            // Arrange
            var productSuggestion = new ProductSuggestion
                {
                    ProductCode = "FLEBM90-32M",
                    ProductId = 36864
                };

            // Act
            bool equal = productSuggestion.Equals(null);

            // Assert
            Assert.IsFalse(equal);
        }
コード例 #2
0
        public void Equals_OtherIsEqual_ReturnsTrue()
        {
            // Arrange
            var productSuggestion = new ProductSuggestion
            {
                ProductCode = "FLEBM90-32M",
                ProductId = 36864
            };

            var otherProductSuggestion = new ProductSuggestion
            {
                ProductCode = "FLEBM90-32M",
                ProductId = 36864
            };

            // Act
            bool equal = productSuggestion.Equals(otherProductSuggestion);

            // Assert
            Assert.IsTrue(equal);
        }
コード例 #3
0
        public void ParseToString_ToStringThenParse_ReturnsSame()
        {
            // Arrange
            var productSuggestion = new ProductSuggestion
            {
                ProductCode = "FLEBM90-32M",
                ProductId = 36864
            };

            // Act
            string serialised = productSuggestion.ToString();
            var deserialised = ProductSuggestion.Parse(serialised);

            // Assert
            Assert.IsTrue(productSuggestion.Equals(deserialised));
        }