public void RequestId_is_not_null_or_blank_for_new_object() { // arrange // act var request = new PortfolioCalculationRequest(); // assert Assert.False(String.IsNullOrWhiteSpace(request.RequestId)); }
public void SimpleDbEntityHelper_reports_primary_key_is_RequestId() { var guid = Guid.NewGuid().ToString(); var request = new PortfolioCalculationRequest {RequestId = guid}; var helper = new SimpleDbEntityHelper(); // act var actual = helper.GetPrimaryKeyValueOfEntity<PortfolioCalculationRequest>(request); // assert Assert.That(actual, Is.EqualTo(guid)); }
public void Default_constructor_sets_request_date_to_now() { // arrange var dt = (new DateTime(2008, 3, 4, 2, 1, 3)).ToUniversalTime(); SystemTime.Now = () => dt; var expected = dt.ToString("R"); // act var request = new PortfolioCalculationRequest(); // assert Assert.That(request.RequestDateString, Is.EqualTo(expected)); }
public void Convert_correctly_converts_PortfolioFileInfo() { // arrange var portfolioFileInfo = "foo bar bat"; var request = new PortfolioCalculationRequest { PortfolioFileInfo = portfolioFileInfo }; var provider = new PortfolioCalculationRequestProvider(); // act var model = provider.Convert(request); // assert Assert.That(model.PortfolioFileInfo, Is.EqualTo(portfolioFileInfo)); }
public void Convert_correctly_converts_RequestDate() { // arrange var requestDate = new DateTime(2011, 2, 3, 15, 3, 21); var ts = requestDate.ToTimestamp(); var request = new PortfolioCalculationRequest { RequestTimestamp = ts }; var provider = new PortfolioCalculationRequestProvider(); // act var model = provider.Convert(request); // assert Assert.That(model.RequestTimestamp, Is.EqualTo(ts)); }
public void CreatePutAttributesRequest_returns_correct_value_for_non_primary_key_column() { // arrange var entity = new PortfolioCalculationRequest { CreatedBy = "Anthony", }; var client = AwsClientFactory.CreateSimpleDbClient(); // act var request = client.CreatePutAttributesRequest<PortfolioCalculationRequest>(entity); // assert Assert.IsNotNull(request.Attribute); Assert.That(request.Attribute.First(x => x.Name == "CreatedBy").Value, Is.EqualTo("Anthony")); }
public void CreatePutAttributesRequest_sets_property_to_empty_string_if_null() { // arrange var timestamp = DateTime.Now.ToTimestamp(); var entity = new PortfolioCalculationRequest { RequestId = Guid.NewGuid().ToString(), CreatedBy = "Anthony", ModifiedBy = "Anthony", CreateTimestamp = timestamp, ModifyTimestamp = timestamp, ClientIp = null, }; var client = AwsClientFactory.CreateSimpleDbClient(); // act var request = client.CreatePutAttributesRequest<PortfolioCalculationRequest>(entity); var attributeValue = request.Attribute.First(x => x.Name == "ClientIp").Value; // assert Assert.That(attributeValue, Is.EqualTo("")); }
public void Convert_correctly_converts_RequestId() { // arrange var guid = Guid.NewGuid().ToString(); var request = new PortfolioCalculationRequest {RequestId = guid}; var provider = new PortfolioCalculationRequestProvider(); // act var model = provider.Convert(request); // assert Assert.That(model.RequestId, Is.EqualTo(guid)); }
public void Convert_correctly_converts_Status() { // arrange var status = PortfolioCalculationRequestStatus.Error; var request = new PortfolioCalculationRequest { Status = status }; var provider = new PortfolioCalculationRequestProvider(); // act var model = provider.Convert(request); // assert Assert.That(model.Status, Is.EqualTo(status)); }
protected internal virtual PortfolioCalculationRequest Convert(PortfolioCalculationRequestInputModel model) { var request = new PortfolioCalculationRequest { ClientIp = model.ClientIp, CreatedBy = model.CreatedBy, CreateTimestamp = model.CreateTimestamp, ModifiedBy = model.ModifiedBy, ModifyTimestamp = model.ModifyTimestamp, Origin = model.Origin, RequestTimestamp = model.RequestTimestamp, RequestId = model.RequestId, Status = PortfolioCalculationRequestStatus.New, }; return request; }
protected internal virtual PortfolioCalculationRequestViewModel Convert(PortfolioCalculationRequest request) { var model = new PortfolioCalculationRequestViewModel { RequestId = request.RequestId, RequestTimestamp = request.RequestTimestamp, ClientIp = request.ClientIp, CreatedBy = request.CreatedBy, CreateTimestamp = request.CreateTimestamp, ModifiedBy = request.ModifiedBy, ModifyTimestamp = request.ModifyTimestamp, PortfolioFileInfo = request.PortfolioFileInfo, Status = request.Status, }; return model; }
public void SaveEntity_does_not_throw_for_PortfolioCalculationRequest() { var timestamp = DateTime.Now.ToTimestamp(); var entity = new PortfolioCalculationRequest { RequestId = Guid.NewGuid().ToString(), CreatedBy = "Anthony", ModifiedBy = "Anthony", CreateTimestamp = timestamp, ModifyTimestamp = timestamp, Origin = "TEST" }; var client = AwsClientFactory.CreateSimpleDbClient(); client.SaveEntity<PortfolioCalculationRequest>(entity); }