public void PaymentMethodService_Exists_Item_Does_Not_Exists_Returns_False() { var mock = ServiceMocks.GetMockPaymentMethodService(); var actual = mock.Exists(baseTestData.Name); Assert.IsFalse(actual); }
public void PaymentMethodService_GetById_Item_Does_Not_Exist_Returns_Null() { var mock = ServiceMocks.GetMockPaymentMethodService(); var result = mock.GetById(baseTestData.Id); Assert.IsNull(result); }
public void PaymentMethodService_Create_From_Object_Name_Already_Exists_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); mock.Create(baseTestData); }
public void PaymentMethodService_Save_Name_Exists_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); mock.Save(baseTestData.Id, baseTestData.Name); }
public void PaymentMethodService_GetAll_Returns_Empty_List_If_No_Data_Exists() { var mock = ServiceMocks.GetMockPaymentMethodService(); var actual = mock.GetAll(); CollectionAssert.AreEquivalent(new List <PaymentMethod>(), actual.ToList()); }
public void PaymentMethodService_Create_From_Params_Name_Already_Exists_Not_Case_Sensitive_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); mock.Create(baseTestData.Name.ToUpper()); }
public void PaymentMethodService_Exists_Item_Exists_Returns_True() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { _baseTestData }); var actual = mock.Exists(_baseTestData.Name); Assert.IsTrue(actual); }
public void PaymentMethodService_Exists_Item_Exists_Case_Insensitive_Returns_True() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); var actual = mock.Exists(baseTestData.Name.ToLower()); Assert.IsTrue(actual); }
public void PaymentMethodService_GetAll_Returns_Existing_Data() { var expected = Enumerable.Range(1, 5).Select(i => new PaymentMethod(i, $"{i} test")).ToList(); var mock = ServiceMocks.GetMockPaymentMethodService(expected); var actual = mock.GetAll(); CollectionAssert.AreEquivalent(expected, actual.ToList()); }
public void PaymentMethodService_GetById_Item_Exists() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); var result = mock.GetById(baseTestData.Id); Assert.IsNotNull(result); Assert.AreEqual(baseTestData, result); }
public void PaymentMethodService_Save_Item_Exists_Saves_It() { var name = "new-test"; var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); mock.Save(baseTestData.Id, name); var actual = mock.GetById(baseTestData.Id); Assert.IsNotNull(actual); Assert.AreEqual(name, actual.Name); }
public void PaymentMethodService_Save_Item_Does_Not_Exist_Non_Zero_Id_Does_Nothing() { var name = "new-test"; var mock = ServiceMocks.GetMockPaymentMethodService(); var before = mock.GetById(baseTestData.Id); Assert.IsNull(before); mock.Save(baseTestData.Id, name); var actual = mock.GetAll().FirstOrDefault(e => e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); Assert.IsNull(actual); }
public void PaymentMethodService_Save_Item_Does_Not_Exist_Zero_Id_Creates_It() { var name = "new-test"; var mock = ServiceMocks.GetMockPaymentMethodService(); var before = mock.GetAll().FirstOrDefault(c => c.Name == name); Assert.IsNull(before); mock.Save(0, name); var actual = mock.GetAll().FirstOrDefault(e => e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); Assert.IsNotNull(actual); }
public void PaymentMethodService_Create_From_Params_Name_Has_A_Value_Adds_Item() { var mock = ServiceMocks.GetMockPaymentMethodService(); var before = mock.GetAll(); Assert.IsFalse(before.Where(e => e.Name.Equals(baseTestData.Name, StringComparison.OrdinalIgnoreCase)).Count() > 0); mock.Create(baseTestData.Name, baseTestData.Id); var after = mock.GetAll(); Assert.IsTrue(after.Where(e => e.Name.Equals(baseTestData.Name, StringComparison.OrdinalIgnoreCase)).Count() > 0); var actual = mock.GetById(baseTestData.Id); Assert.IsNotNull(actual); Assert.IsTrue(baseTestData.Equals(actual)); }
public void PaymentMethodService_Create_From_Object_Name_Has_A_Value_Adds_Item() { var mock = ServiceMocks.GetMockPaymentMethodService(); var before = mock.GetAll(); Assert.IsFalse(before.Contains(baseTestData)); mock.Create(baseTestData); var after = mock.GetAll(); Assert.IsTrue(after.Contains(baseTestData)); var actual = mock.GetById(baseTestData.Id); Assert.IsNotNull(actual); Assert.AreEqual(baseTestData, actual); }
public void PaymentMethodService_Delete_Name_Exists_Removes_Item() { var mock = ServiceMocks.GetMockPaymentMethodService(new List <PaymentMethod> { baseTestData }); var before = mock.GetAll(); Assert.IsTrue(before.Contains(baseTestData)); mock.Delete(baseTestData.Name); var after = mock.GetAll(); Assert.IsFalse(after.Contains(baseTestData)); var actual = mock.GetById(baseTestData.Id); Assert.IsNull(actual); }
public void PaymentMethodService_Create_From_Params_Name_Is_WhiteSpace_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Create("\t", 1); }
public void PaymentMethodService_Create_From_Object_Name_Is_WhiteSpace_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Create(new PaymentMethod(1, "\t")); }
public void PaymentMethodService_Delete_Name_Does_Not_Exist_Does_Nothing() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Delete(baseTestData.Name); }
public void PaymentMethodService_Delete_Name_Is_Whitespace_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Delete(" "); }
public void PaymentMethodService_Delete_Name_Is_Null_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Delete(null); }
public void PaymentMethodService_Create_From_Params_Name_Is_Null_No_Id_Given_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Create(name: null); }
public void PaymentMethodService_Create_From_Object_Object_Is_Null_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Create(null); }
public void PaymentMethodService_Save_Name_Is_Null_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Save(baseTestData.Id, null); }
public void PaymentMethodService_Save_Name_Is_Whitespace_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Save(baseTestData.Id, "\n\n\n"); }
public void PaymentMethodService_Exists_Name_Is_Whitespace_Throws_Exception() { var mock = ServiceMocks.GetMockPaymentMethodService(); mock.Exists("\r\n"); }