コード例 #1
0
        public void DeleteUser()
        {
            // Arrange
            ExternalService exService = new ExternalService();
            UserService service = new UserService(exService);

            using (var _session = DBSetup())
            {
                var userModel = new User()
                {
                    FirstName = "TestFN",
                    LastName = "TestLN",
                    Email = "*****@*****.**",
                    StreetAddress = "TestSA",
                    City = "TestCity",
                    State = "TestState",
                    Zip = "99999"
                };
                _session.Store(userModel);
                _session.SaveChanges();

                // Act
                string result = service.DeleteUser(_session, "users/1");

                // Assert
                Assert.IsNotNull(result);

                var user = _session.Load<User>(result);

                Assert.IsNull(user);
            }
        }
コード例 #2
0
        public void DeleteUserFail()
        {
            // Arrange
            ExternalService exService = new ExternalService();
            UserService service = new UserService(exService);

            using (var _session = DBSetup())
            {
                // Act
                string result = service.DeleteUser(_session, "users/1");

                // Assert
                Assert.IsNull(result);
            }
        }