public async void Check02UpdateFailOk() { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateServiceAsync<Tag, SimpleTagDtoAsync>(db); var dto = new SimpleTagDtoAsync(); dto.SetSupportedFunctions(CrudFunctions.None); //ATTEMPT var status = await service.UpdateAsync(dto); //VERIFY status.IsValid.ShouldEqual(false); status.Errors.Count.ShouldEqual(1); status.Errors[0].ErrorMessage.ShouldEndWith("is not supported in this mode."); dto.FunctionsCalledCommaDelimited.ShouldEqual(""); } }
public async void Check02CreateFailOk() { using (var db = new SampleWebAppDb()) { //SETUP var service = new CreateServiceAsync <Tag, SimpleTagDtoAsync>(db); var dto = new SimpleTagDtoAsync(); dto.SetSupportedFunctions(CrudFunctions.None); //ATTEMPT var status = await service.CreateAsync(dto); //VERIFY status.IsValid.ShouldEqual(false); status.Errors.Count.ShouldEqual(1); status.Errors[0].ErrorMessage.ShouldEndWith("is not supported in this mode."); dto.FunctionsCalledCommaDelimited.ShouldEqual(""); } }
public async void Check02CreateFlow(InstrumentedOpFlags errorFlag, bool isValid, string expectedFunctionsCalled) { using (var db = new SampleWebAppDb()) { //SETUP var service = new CreateServiceAsync <Tag, SimpleTagDtoAsync>(db); var dto = new SimpleTagDtoAsync(errorFlag) { Name = "Test Name", Slug = Guid.NewGuid().ToString("N") }; //ATTEMPT var status = await service.CreateAsync(dto); //VERIFY status.IsValid.ShouldEqual(isValid); dto.FunctionsCalledCommaDelimited.ShouldEqual(expectedFunctionsCalled); } }
public async void Check02UpdateFlow(InstrumentedOpFlags errorFlag, bool isValid, string expectedFunctionsCalled) { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateServiceAsync<Tag, SimpleTagDtoAsync>(db); var dto = new SimpleTagDtoAsync(errorFlag) { TagId = db.Tags.First().TagId, Name = "Test Name", Slug = Guid.NewGuid().ToString("N") }; //ATTEMPT var status = await service.UpdateAsync(dto); //VERIFY status.IsValid.ShouldEqual(isValid); dto.FunctionsCalledCommaDelimited.ShouldEqual(expectedFunctionsCalled); } }