public void AddNewProfile_Return_IdAndTrue() { //Arrange var options = GetContextOptions(); var newProfile = new ProfileViewModel() { Balance = 1, BankBook = Guid.NewGuid().ToString(), FirstName = Guid.NewGuid().ToString(), LastName = Guid.NewGuid().ToString(), SecondName = Guid.NewGuid().ToString(), Passport = Guid.NewGuid().ToString(), OrgName = Guid.NewGuid().ToString(), IsSeller = false, OrgNumber = Guid.NewGuid().ToString() }; var guid = string.Empty; var result = string.Empty; var success = false; //Act using (var context = new ProfileContext(options)) { IProfileService profileService = new ProfileService(context, _mapper, _rabbitMQService.Object, _scopeFactory); (result, success) = profileService.AddNewProfileAsync(newProfile).GetAwaiter().GetResult(); guid = context.Profiles.FirstOrDefault().Id.ToString(); } //Assert Assert.True(success); Assert.Equal(guid, result); }
public void AddNewProfile_Return_IdAndFalse() { //Arrange var options = GetContextOptions(); var profileModel = new ProfileModel() { Balance = 1, BankBook = Guid.NewGuid().ToString(), FirstName = Guid.NewGuid().ToString(), LastName = Guid.NewGuid().ToString(), SecondName = Guid.NewGuid().ToString(), Passport = "Passport", OrgName = Guid.NewGuid().ToString(), IsSeller = false, OrgNumber = Guid.NewGuid().ToString() }; var profileViewModel = new ProfileViewModel() { Balance = 1, BankBook = Guid.NewGuid().ToString(), FirstName = Guid.NewGuid().ToString(), LastName = Guid.NewGuid().ToString(), SecondName = Guid.NewGuid().ToString(), Passport = "Passport", OrgName = Guid.NewGuid().ToString(), IsSeller = false, OrgNumber = Guid.NewGuid().ToString() }; var result = string.Empty; var success = false; //Act using (var context = new ProfileContext(options)) { context.Profiles.Add(profileModel); context.SaveChanges(); IProfileService profileService = new ProfileService(context, _mapper, _rabbitMQService.Object, _scopeFactory); (result, success) = profileService.AddNewProfileAsync(profileViewModel).GetAwaiter().GetResult(); } //Assert Assert.False(success); Assert.Equal(GlobalConstants.PROFILE_SERVICE_FAIL, result); }