'NUnit Test Cases: Run both, one fails; Run separately, both pass

In short, I have two NUnit test cases in a Standard project using Moq that when I run them individually, they pass, but run separately the second one fails. Specifically, the first takes 1.9s to run, and the second fails immediately (118ms) saying the result is 0 though it should be 1.

Code (included sample setup code for orders, test code and code being tested):

[SetUp]
    public void Initialize()
    {
        clocationData = new CalfeeLocationData();
        clocationData.ApplyDefaultMockDataset();
        mlocationData = new MeetingLocationData();
        mlocationData.ApplyDefaultMockDataset();
        mlocationLayoutData = new MeetingLocationLayoutData();
        mlocationLayoutData.ApplyDefaultMockDataset();
        orderData = new OrderData();
        orderData.ApplyDefaultMockDataset();
        orderDetailData = new OrderDetailData();
        orderDetailData.ApplyDefaultMockDataset();

        orderRepository = (OrderRepository)orderData.GetRepository();

    }

public override void ApplyDefaultMockDataset()
    {
        ClearMockData();
        SetDefaultOrder();
    }
    private void SetDefaultOrder()
    {
        var ord = new Order()
        {
            EntryId = "000-333",
            GlobalId = "000-999-99999",
            OrganizerGraphId = "Id",
            BillingInfo = "Nada",
            OtherInstructions = "No Other Complications",
            MeetingLocationId = 79
        };
        AddMockData(ord);
    }

    [TestCase(true, 1)]
    [TestCase(false, 1)]
    public void GetAllByCreator_OneTest(bool includeDelete, int expectedCount)
    {
        var saveModel = CreateOrder();
        orderRepository.Save(saveModel);
        var foundOrder = orderRepository.GetById(saveModel.OrderId);
        foundOrder.OrganizerEmail = testEmail;
        orderRepository.Save(foundOrder);

        var foundOrders = orderRepository.GetAllByOrganizer(saveModel.OrganizerEmail, includeDelete);

        Assert.AreEqual(expectedCount, foundOrders.Count);
    }

public List<Order> GetAllByOrganizer(string organizerEmail, bool getDeleted = false)
    {
        var baseQuery = GetDataQueryBase();
        var orders = baseQuery.Where(mod => mod.OrganizerEmail == organizerEmail);
        if (!getDeleted) orders = orders.Where(mod => !mod.Deleted);
        return orders.OrderBy(c => c.CreatedDate).ToList();
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source