public void Can_Convert_To_And_From_Entity() { var model = new ServiceApiDescription(); var entity = model.ToEntity(); model = entity.ToModel(); entity.Should().NotBeNull(); model.Should().NotBeNull(); }
public async Task Registers_New_Service_When_Not_Exists() { var description = new ApiDescriptionBuilder().WithServiceId("MyApi").Build(); _store.Setup(s => s.FindByServiceIdAsync("NewService")).ReturnsAsync((ServiceApiDescription)null); ServiceApiDescription newDescription = null; _store.Setup(s => s.StoreAsync(It.IsAny <ServiceApiDescription>())).Callback <ServiceApiDescription>(s => newDescription = s).Returns(Task.CompletedTask); await _serviceRepository.StoreApiAsync(description); newDescription.Should().NotBeNull(); newDescription.ServiceId.Should().Be("MyApi"); newDescription.ApiDocument.Should().NotBeNull(); }