public void Test_Create() { var password = _fixture.Create <string>(); var model = GetSenderModel(password); _controller.Create(model); VerifyData(model); VerifyPassword(model.Authentication.Login, password); }
public void AddSenderTest(string cpr, string firstName, string lastName, string phone, string email, string address, string zipCode, string city, string username, string password) { //setup var senderServiceMock = new Mock <ISenderService>(); var reg = new RegisterModel { Cpr = cpr, FirstName = firstName, LastName = lastName, PhoneNumber = phone, Email = email, Address = address, ZipCode = zipCode, City = city, Username = username, Password = password }; //SenderModel sender = new SenderModel(reg.Cpr, reg.FirstName, reg.LastName, reg.PhoneNumber, reg.Email, reg.Address, reg.ZipCode, reg.City) { AccountType = (int)AccountTypeEnum.SENDER, Password = reg.Password, Username = reg.Username, Points = 0 }; //DeliveryService.SenderModel senderToService = new DeliveryService.SenderModel { AccountType = sender.AccountType, Address = sender.Address, City = sender.City, Cpr = sender.Cpr, Email = sender.Email, FirstName = sender.FirstName, LastName = sender.LastName, Password = sender.Password, PhoneNumber = sender.PhoneNumber, Points = sender.Points, Username = sender.Username, ZipCode = sender.ZipCode }); //senderServiceMock.Setup(x => x.AddSender(senderToService)).Returns(1); senderServiceMock.Setup(x => x.AddSender(It.IsAny <SenderResource>())).Returns(1); var sut = new SenderController(senderServiceMock.Object); var res = sut.Create(reg); //assert Assert.AreNotEqual(res, new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); //afte }