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

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

                // Assert
                Assert.IsNull(result);
            }
        }
コード例 #2
0
        public void GetUser()
        {
            // 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
                User result = service.GetUser(_session, "users/1");

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual(result.Id, "users/1");
                Assert.AreEqual(userModel.Id, "users/1");
            }
        }