public void Reset() { PhoneOrderEntity orderInstance; var factory = new PhoneOrderEntityFactory(); Guid emptyGuid = Guid.Parse("00000000-0000-0000-0000-000000000000"); DateTime emptyTime = DateTime.FromBinary(0); factory.SetName("a", "b"); factory.SetPhoneNumber("5555"); factory.SetStreet("444 street"); factory.SetCity("some city"); factory.SetZipcode(12345); factory.GenerateId(); factory.GeneratePlacedOnDate(); factory.SetStatus(PhoneOrderEntity.ApprovalStatus.Open); factory.Reset(); orderInstance = factory.GetInstance(); Assert.Null(orderInstance.FirstName); Assert.Null(orderInstance.LastName); Assert.Null(orderInstance.Phone); Assert.Null(orderInstance.Street); Assert.Null(orderInstance.City); Assert.AreEqual(0, orderInstance.Zipcode); Assert.NotNull(orderInstance.Id); Assert.AreEqual(emptyGuid, orderInstance.Id); Assert.NotNull(orderInstance.PlacedOn); Assert.AreEqual(emptyTime, orderInstance.PlacedOn); Assert.AreEqual(PhoneOrderEntity.ApprovalStatus.PendingApproval, orderInstance.Status); }
public void GeneratePlacedOnDate() { PhoneOrderEntity orderInstance; var factory = new PhoneOrderEntityFactory(); factory.GeneratePlacedOnDate(); orderInstance = factory.GetInstance(); Assert.NotNull(orderInstance.PlacedOn); }
public String CreatePhoneOrder(Stream body) { String json = getJsonFromBody(body); ResponseDTO responseDTO = new ResponseDTO(); PhoneOrderEntity order; phoneOrderEntityFactory.FromJson(json); phoneOrderEntityFactory.GenerateId(); phoneOrderEntityFactory.GeneratePlacedOnDate(); phoneOrderEntityFactory.SetStatus(PhoneOrderEntity.ApprovalStatus.Open); order = phoneOrderEntityFactory.GetInstance(); phoneOrderRepository.InsertPhoneOrder(order); responseDTO.Result = "Done"; return(JsonConvert.SerializeObject(responseDTO)); }