public void TestAddCarpentryServiceType() { var service = new CarpentryServiceTypeService(carpentryWebsiteContext); CarpentryServiceType itemToAdd = new CarpentryServiceType { CarpentryServiceTypeId = 105, Name = "Name" }; service.AddCarpentryServiceType(itemToAdd); CarpentryServiceType result = service.GetCarpentryServiceTypeDetails(105); Assert.Equal(itemToAdd, result); }
public void TestEditCarpentryServiceTypes() { string expectedName = "Edited name"; var service = new CarpentryServiceTypeService(carpentryWebsiteContext); CarpentryServiceType itemToAdd = new CarpentryServiceType { CarpentryServiceTypeId = 16, Name = "Name" }; service.AddCarpentryServiceType(itemToAdd); carpentryWebsiteContext.Entry(service.GetCarpentryServiceTypeDetails(16)).State = EntityState.Detached; service.UpdateCarpentryServiceType(new CarpentryServiceType { CarpentryServiceTypeId = 16, Name = "Edited name" }); CarpentryServiceType result = service.GetCarpentryServiceTypeDetails(16); Assert.Equal(expectedName, result.Name); }
public int Create([FromBody] CarpentryServiceType carpentryServiceType) { return(carpentryServiceTypeService.AddCarpentryServiceType(carpentryServiceType)); }