コード例 #1
0
        public void TestGetCustomers()
        {
            // Act
            var result = TestContextInstance.Get();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
            //
        }
コード例 #2
0
        public void TestAddCustomer()
        {
            // Arrange


            // Act
            var result = TestContextInstance.Get(CreatedCustomer.CustomerId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.CustomerId, CreatedCustomer.CustomerId);
            //
        }
コード例 #3
0
        public void TestGetCustomerWithNonExistentId()
        {
            // Arrange

            var result = TestContextInstance.Get(-1);


            // Act


            //Assert
            Assert.IsNull(result);
        }
コード例 #4
0
        public void CustomerCleanup()
        {
            var customer = TestContextInstance.Get()
                           .FirstOrDefault(c => c.CustomerId == CreatedCustomer.CustomerId);

            if (customer != null)
            {
                TestContextInstance.Delete(customer.CustomerId);
            }
            else
            {
                throw new Exception("Customer was not found!");
            }
        }
コード例 #5
0
        public void TestUpdateCustomer()
        {
            // Arrange
            var result = TestContextInstance.Get(CreatedCustomer.CustomerId);

            result.FirstName = result.FirstName + "1";
            result.LastName  = result.LastName + "1";

            // Act
            TestContextInstance.Put(result.CustomerId, result);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.FirstName, CreatedCustomer.FirstName.ToLower(), true);
            //
        }
コード例 #6
0
        public void TestGetCustomer()
        {
            // Arrange
            var customer = TestContextInstance.Get().FirstOrDefault();

            // Act
            if (customer != null)
            {
                var result = TestContextInstance.Get(customer.CustomerId);

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual(result.CustomerId, customer.CustomerId);
            }
            else
            {
                throw new Exception("no Customer is found!");
            }

            //
        }