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 SetStreet() { PhoneOrderEntity orderInstance; var factory = new PhoneOrderEntityFactory(); const String street = "555 Happy Street"; factory.SetStreet(street); orderInstance = factory.GetInstance(); Assert.AreEqual(street, orderInstance.Street); }
public String CreateDefaultOrder() { ResponseDTO responseDTO = new ResponseDTO(); phoneOrderEntityFactory.GenerateId(); phoneOrderEntityFactory.SetName("John", "Smith"); phoneOrderEntityFactory.SetStreet("356 Rosewood"); phoneOrderEntityFactory.SetCity("Happyville"); phoneOrderEntityFactory.SetZipcode(31415); phoneOrderEntityFactory.SetPhoneNumber("555-5555"); phoneOrderEntityFactory.SetStatus(PhoneOrderEntity.ApprovalStatus.Open); phoneOrderEntityFactory.SetPlacedOnDate(DateTime.Now); PhoneOrderEntity defaultOrder = phoneOrderEntityFactory.GetInstance(); phoneOrderRepository.InsertPhoneOrder(defaultOrder); responseDTO.Result = "Done"; return(JsonConvert.SerializeObject(responseDTO)); }