示例#1
0
        public void Delete_ShouldRemoveFromContext()
        {
            this.Context.Database.EnsureDeleted();

            Customer testC = new Customer()
            {
                FirstName = "Dude",
                LastName  = "Damn",
                Email     = "mail.test@something"
            };

            var SUT  = new InMemoryDatabaseCustomerService(this.Context);
            var newC = SUT.Add(testC);

            SUT.Delete(newC);

            this.Context.Customers.Find(newC.Id).Should().BeNull();
        }
示例#2
0
        public void Add_WhenCalled_AddsCustomerToContext()
        {
            this.Context.Database.EnsureDeleted();

            Customer testC = new Customer()
            {
                FirstName = "Dude",
                LastName  = "Damn",
                Email     = "mail.test@something"
            };

            // // var newC = this.Context.Customers.Add(testC).Entity;

            var SUT  = new InMemoryDatabaseCustomerService(this.Context);
            var newC = SUT.Add(testC);

            this.Context.Customers.Find(newC.Id).Should().BeEquivalentTo(testC); //BREAKS HAAAARD with SUT
        }
示例#3
0
        public void Update_ShouldModifyMembers()
        {
            this.Context.Database.EnsureDeleted();

            Customer testC = new Customer()
            {
                FirstName = "Dude",
                LastName  = "Damn",
                Email     = "mail.test@something"
            };

            var SUT  = new InMemoryDatabaseCustomerService(this.Context);
            var newC = SUT.Add(testC);

            var testEmail = "*****@*****.**";

            newC.Email = testEmail;

            SUT.Update(newC);

            this.Context.Customers.Find(newC.Id).Email.Should().BeEquivalentTo(testEmail); //BREAKS HAAAARD with SUT
        }