public static void Authorize_Test() { //Arange var user = new User { UserId = 1, Disabled = false, Login = "******", Password = "******", RoleId = 1, Role = new Role { Name = "Admin" } }; const int days = 7; var expirationDate = DateTime.Now.AddDays(days).ToLocalTime(); var security = new WebSecurity(); //Act var cookie = security.Authorize(user); var emptyCookie = security.Authorize(null); //Assert Assert.That(cookie, Is.Not.Null); Assert.That(cookie.Name == ".ASPXAUTH"); Assert.That(TrimToSeconds(cookie.Expires) == TrimToSeconds(expirationDate)); Assert.That(emptyCookie, Is.Null); }